package demo1;

import java.util.Arrays;
import java.util.Comparator;

public class test2 {

    public static void main(String[] args) {
        Integer[] arr={1,2,4,5,3};
        Arrays.sort(arr);
        System.out.println(Arrays.toString(arr));
    }

    public static void main3(String[] args) {
        Integer[] arr={1,2,4,5,3};
        Arrays.sort(arr, new Comparator() {
            @Override
            public int compare(Object o1, Object o2) {
                Integer i1=(Integer) o1;
                Integer i2=(Integer) o2;
                return i2-i1;
            }
        });
        System.out.println(Arrays.toString(arr));
    }

    public static void main2(String[] args) {
        Integer[] arr={1,2,4,5,3};
        Arrays.sort(arr);
        System.out.println(Arrays.toString(arr));
    }




    public static void main1(String[] args) {
        Integer[] arr={10,20,30};
        for(int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println(Arrays.toString(arr));
    }
}
